package edu.towson.cosc603.coffeemaker;

import junit.framework.TestCase;

import org.junit.Before;
import org.junit.After;
import org.junit.Test;


public class InventoryTest extends TestCase{
	Inventory inv;

	@Before
	public void setUp() throws Exception {
		inv = new Inventory();

	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testInventory() {
		
	}

	@Test
	public void testGetChocolate() {		
		assertEquals(15, inv.getChocolate(), 0);
		
	}

	@Test
	public void testSetChocolate() {
		inv.setChocolate(2);
        assertEquals(2, inv.getChocolate(), 0);
	}
	
	@Test
	public void testSetChocolateLessthanzero() {
		inv.setChocolate(-1);
		assertEquals(0, inv.getChocolate(), 0);
	}

	@Test
	public void testGetCoffee() {
		assertEquals(15, inv.getCoffee(), 0);
	}

	@Test
	public void testSetCoffee() {
		inv.setCoffee(2);
        assertEquals(2, inv.getCoffee(), 0);
	}

	@Test
	public void testSetCoffeeLessthanzero() {
		inv.setCoffee(-1);
        assertEquals(0, inv.getCoffee(), 0);
	}
	
	
	
	@Test
	public void testGetMilk() {
		assertEquals(15, inv.getMilk());
	}

	@Test
	public void testSetMilk() {
		inv.setMilk(2);
        assertEquals(2, inv.getMilk(), 0);
	}
	
	
	@Test
	public void testSetMilkLessthanzero() {
		inv.setMilk(-1);
        assertEquals(0, inv.getMilk(), 0);
	}
	
	@Test
	public void testGetSugar() {
		assertEquals(15, inv.getSugar(), 0);
	}

	@Test
	public void testSetSugar() {
		inv.setSugar(2);
        assertEquals(2, inv.getSugar(), 0);
	}
	
	@Test
	public void testSetSugarLessthanzero() {
		inv.setSugar(-1);
        assertEquals(0, inv.getSugar(), 0);
	}
	
	@Test
	public void testEnoughIngredients() {
		 Recipe r1 = new Recipe();
		 assertTrue(inv.enoughIngredients(r1));		 
	}

	@Test
	public void testEnoughIngredients1() {
		 Recipe r1 = new Recipe();		 
	     r1.setName("Coffee");
	     r1.setPrice(50);
	     r1.setAmtCoffee(50);
	     r1.setAmtMilk(50);
	     r1.setAmtSugar(50);
	     r1.setAmtChocolate(50);
	     inv.setChocolate(10);
	     inv.setCoffee(10);
	     inv.setSugar(10);
	     inv.setMilk(10);
		 assertFalse(inv.enoughIngredients(r1));		 
	}
	
	@Test
	public void testToString() {
		assertEquals("Coffee: " + 15 + "\n" +
			"Milk: " + 15 + "\n" +
			"Sugar: " + 15 + "\n" +
			"Chocolate: " + 15 + "\n", inv.toString());
	}

}
